﻿using System;
using System.Diagnostics;

namespace FinalYear.Helpers
{
    public enum Procedure
    {
        RenderImages,
        ProcessLucasKanade,
        RenderFeaturePoints,
        ProcessOverallFeatureDetectionAndTrack,
    }

    public class EfficiencyTimer
    {
        private Stopwatch currentWatch;
        private Procedure currentProcedure;
        private string toDebugger;

        public EfficiencyTimer(Procedure currentProcedure)
        {
            this.currentProcedure = currentProcedure;
            this.toDebugger = string.Format("Started Procedure {0} at {1}", currentProcedure.ToString(), DateTime.Now);
            currentWatch = new Stopwatch();
            currentWatch.Start();
            System.Diagnostics.Debug.WriteLine(toDebugger);
        }

        public void TerminateTimer()
        {
            this.currentWatch.Stop();
            this.toDebugger = string.Format("Ended Procedure {0} at {1}, Time Elapsed {2}", this.currentProcedure.ToString(), DateTime.Now, this.currentWatch.Elapsed);
            System.Diagnostics.Debug.WriteLine(toDebugger);
        }
    }
}